﻿using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Graphics.Effects;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using 纸片人.ConvertClass;
using 纸片人.win2dEffectControl.DataClass;

// The Templated Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234235

namespace 纸片人.win2dEffectControl
{
    public sealed class BorderEffectControl : EffectControl
    {
        private ComboBox extendXComboBox;
        private ComboBox extendYComboBox;

        public override EffectOneSourceData OneEffetData { get; set; }

        List<CanvasEdgeBehavior> listEdgeBehavior = new List<CanvasEdgeBehavior>();
        public BorderEffectControl()
        {
            this.DefaultStyleKey = typeof(BorderEffectControl);
            OneEffetData = new BorderEffectData();
            listEdgeBehavior = EffectUtil.GetEnumList<CanvasEdgeBehavior>();

        }

        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            extendXComboBox = GetTemplateChildFormName<ComboBox>(nameof(extendXComboBox));
            SetComboBox(extendXComboBox, listEdgeBehavior, OneEffetData, nameof(BorderEffectData.ExtendX));

            extendYComboBox = GetTemplateChildFormName<ComboBox>(nameof(extendYComboBox));
            SetComboBox(extendYComboBox, listEdgeBehavior, OneEffetData, nameof(BorderEffectData.ExtendY));


        }





    }
}
